package com.tanxiaoyao.wecon.app;

import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;

import java.util.HashMap;

/**
 * Created by tanxiaoyao on 2015/1/3.
 * 应用程序配置类：用于保存用户相关信息及设置
 */
public class AppSetting {


    private static AppSetting appSetting;
    private Context mContext;

    public static AppSetting getAppSetting(Context context)
    {
        if(appSetting == null){
            appSetting = new AppSetting();
            appSetting.mContext = context;
        }
        
        return appSetting;
    }

    /**
     * 声明蓝牙设备信息存储单元
     */
    public static HashMap<String,String> blutooDevs;

    /**
     * 得到存储器
     * @return 一个HashMap用于存储蓝牙设备信息
     */
    public static HashMap<String,String> getBlutooDevInfo(){
        if(blutooDevs == null){     //如果容器没有建立
            blutooDevs = new HashMap<String, String>();
        }
        return blutooDevs;
    }

    /**
     * 获取Preference设置
     */
    public static SharedPreferences getSharedPreferences(Context context)
    {
        return PreferenceManager.getDefaultSharedPreferences(context);
    }
}
